App({
  onLaunch: function(options) {
    const updateManager = wx.getUpdateManager()
    updateManager.onCheckForUpdate(function(res) {
      // 请求完新版本信息的回调
    })
    updateManager.onUpdateReady(function() {
      wx.showModal({
        title: '更新提示',
        content: '新版本已经准备好，是否重启应用？',
        success(res) {
          if (res.confirm) {
            // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
            updateManager.applyUpdate()
          }
        }
      })
    })
    updateManager.onUpdateFailed(function() {
      // 新版本下载失败
    })
    let pid = 0;
    if (options.query.scene) {
      var params = decodeURIComponent(options.query.scene)
      var secnearray = params.split("&")
      this.globalData.pid = secnearray[0]
      if (secnearray[1]) {
        this.globalData.activityid = secnearray[1]
      }
      pid = options.scene || 0
    }
    if (options.query.account_id) {
      this.globalData.pid = options.query.account_id
      pid = options.query.account_id || 0
    }
    let openId = wx.getStorageSync('openId') || ''
    let userinfo = wx.getStorageSync('userinfo') || ''
    if (options.scene == 1007 || options.scene == 1008 || options.scene == 1044) {
      this.globalData.share = true
    } else {
      this.globalData.share = false
    };
    this.globalData.headtips = wx.getStorageSync('headtips') || 0
    wx.getSystemInfo({
      success: (res) => {
        this.globalData.height = res.statusBarHeight
      }
    })
  },
  onShow: function(options) {},
  u: {
    // url: 'http://113.240.226.150:9292/api',
    // url: 'https://api.myh2o.org.cn/api', //小程序正式版接口
    url: 'http://192.168.0.112:8282/api',
    index: {
      GetTagItem: "/wechat/index/getTagItem",
      SelectListVillage: "/wechat/index/selectListVillage",
      Statistics: "/wechat//index/statistics",
    },
    user: {
      Spokesperson: "/wechat/spokesperson/getCycleSpokesperson"
    },
    sponsor: {
      GetSponsor: "/wechat/sponsor/getSponsor",
      NextLocation: "/wechat/sponsor/nextLocation"
    },
    project: {
      GetProject: "/wechat/project/getProject",
      NextLocation: "/wechat/project/nextLocation"
    },
    team: {
      GetTeam: "/wechat/team/getTeam",
      NextLocation: "/wechat/team/nextLocation",
      NextSponsor: "/wechat/team/nextSponsor"
    },
    village: {
      GetLocation: "/wechat/village/getLocation",
      NextProject: "/wechat/village/nextProject",
      NextSponsor: "/wechat/village/nextSponsor"
    }
  },
  globalData: {
    share: false, // 分享默认为false
    pid: 0,
    headtips: 0, //是否显示小程序显示到桌面
    activityid: 0
  },
})